import { getCurrentScope as v, onScopeDispose as b, unref as t, computed as T, ref as m, watch as P, getCurrentInstance as W, onMounted as U, defineComponent as O, useAttrs as R, openBlock as d, createElementBlock as B, mergeProps as G, createElementVNode as g, normalizeStyle as S, toDisplayString as J, pushScopeId as V, popScopeId as q, useSlots as Z, render as _, h as X, createVNode as $, createCommentVNode as AA, Fragment as eA, renderSlot as oA } from "vue";
function iA(A) {
  return v() ? (b(A), !0) : !1;
}
function z(A) {
  return typeof A == "function" ? A() : t(A);
}
const tA = typeof window < "u", gA = (A) => A != null, K = () => {
};
function N(A) {
  var o;
  const e = z(A);
  return (o = e == null ? void 0 : e.$el) != null ? o : e;
}
const nA = tA ? window : void 0;
function lA() {
  const A = m(!1);
  return W() && U(() => {
    A.value = !0;
  }), A;
}
function sA(A) {
  const o = lA();
  return T(() => (o.value, !!A()));
}
function H(A, o, e = {}) {
  const {
    root: s,
    rootMargin: i = "0px",
    threshold: C = 0.1,
    window: c = nA,
    immediate: u = !0
  } = e, n = sA(() => c && "IntersectionObserver" in c), E = T(() => {
    const l = z(A);
    return (Array.isArray(l) ? l : [l]).map(N).filter(gA);
  });
  let a = K;
  const Q = m(u), L = n.value ? P(
    () => [E.value, N(s), Q.value],
    ([l, F]) => {
      if (a(), !Q.value || !l.length)
        return;
      const M = new IntersectionObserver(
        o,
        {
          root: N(F),
          rootMargin: i,
          threshold: C
        }
      );
      l.forEach((r) => r && M.observe(r)), a = () => {
        M.disconnect(), a = K;
      };
    },
    { immediate: u, flush: "post" }
  ) : K, I = () => {
    a(), L(), Q.value = !1;
  };
  return iA(I), {
    isSupported: n,
    isActive: Q,
    pause() {
      a(), Q.value = !1;
    },
    resume() {
      Q.value = !0;
    },
    stop: I
  };
}
const IA = "", CA = "";
const uA = /* @__PURE__ */ O({
  __name: "loading",
  props: {
    isLoading: { type: Boolean, default: !0 },
    classData: { default: "" },
    themeColor: { default: "" }
  },
  setup(A) {
    let e = A.themeColor ?? "blue", s = R();
    return (i, C) => (d(), B("div", G({ class: "loading-icon" }, t(s)), [
      g("span", {
        style: S("background:" + t(e))
      }, null, 4),
      g("span", {
        style: S("background:" + t(e))
      }, null, 4),
      g("span", {
        style: S("background:" + t(e))
      }, null, 4),
      g("span", {
        style: S("background:" + t(e))
      }, null, 4),
      g("span", {
        style: S("background:" + t(e))
      }, null, 4)
    ], 16));
  }
});
const x = (A, o) => {
  const e = A.__vccOpts || A;
  for (const [s, i] of o)
    e[s] = i;
  return e;
}, cA = /* @__PURE__ */ x(uA, [["__scopeId", "data-v-aacc346e"]]), f = [
  [
    "requestFullscreen",
    "exitFullscreen",
    "fullscreenElement",
    "fullscreenEnabled",
    "fullscreenchange",
    "fullscreenerror"
  ],
  // New WebKit
  [
    "webkitRequestFullscreen",
    "webkitExitFullscreen",
    "webkitFullscreenElement",
    "webkitFullscreenEnabled",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  // Old WebKit
  [
    "webkitRequestFullScreen",
    "webkitCancelFullScreen",
    "webkitCurrentFullScreenElement",
    "webkitCancelFullScreen",
    "webkitfullscreenchange",
    "webkitfullscreenerror"
  ],
  [
    "mozRequestFullScreen",
    "mozCancelFullScreen",
    "mozFullScreenElement",
    "mozFullScreenEnabled",
    "mozfullscreenchange",
    "mozfullscreenerror"
  ],
  [
    "msRequestFullscreen",
    "msExitFullscreen",
    "msFullscreenElement",
    "msFullscreenEnabled",
    "MSFullscreenChange",
    "MSFullscreenError"
  ]
], D = (() => {
  if (typeof document > "u")
    return !1;
  const A = f[0], o = {};
  for (const e of f)
    if ((e == null ? void 0 : e[1]) in document) {
      for (const [i, C] of e.entries())
        o[A[i]] = C;
      return o;
    }
  return !1;
})(), p = {
  change: D.fullscreenchange,
  error: D.fullscreenerror
};
let h = {
  // eslint-disable-next-line default-param-last
  request(A = document.documentElement, o) {
    return new Promise((e, s) => {
      const i = () => {
        h.off("change", i), e();
      };
      h.on("change", i);
      const C = A[D.requestFullscreen](o);
      C instanceof Promise && C.then(i).catch(s);
    });
  },
  exit() {
    return new Promise((A, o) => {
      if (!h.isFullscreen) {
        A();
        return;
      }
      const e = () => {
        h.off("change", e), A();
      };
      h.on("change", e);
      const s = document[D.exitFullscreen]();
      s instanceof Promise && s.then(e).catch(o);
    });
  },
  toggle(A, o) {
    return h.isFullscreen ? h.exit() : h.request(A, o);
  },
  onchange(A) {
    h.on("change", A);
  },
  onerror(A) {
    h.on("error", A);
  },
  on(A, o) {
    const e = p[A];
    e && document.addEventListener(e, o, !1);
  },
  off(A, o) {
    const e = p[A];
    e && document.removeEventListener(e, o, !1);
  },
  raw: D
};
Object.defineProperties(h, {
  isFullscreen: {
    get: () => !!document[D.fullscreenElement]
  },
  element: {
    enumerable: !0,
    get: () => document[D.fullscreenElement] ?? void 0
  },
  isEnabled: {
    enumerable: !0,
    // Coerce to boolean in case of old WebKit.
    get: () => !!document[D.fullscreenEnabled]
  }
});
D || (h = { isEnabled: !1 });
const w = h, aA = (A) => {
  let o = m(""), e = m(0), s = m(!1), i = m(0);
  const C = () => {
    document.documentElement.style.overflowY = "scroll";
    let M = document.querySelector(".img-dialog");
    M.setAttribute("style", "opacity:0"), setTimeout(() => {
      M.parentElement.remove();
    }, 500);
  }, c = () => {
    e.value > 0 ? e.value = e.value - 1 : e.value = A.imgList.length - 1, o.value = A.imgList[e.value];
  }, u = () => {
    e.value < A.imgList.length - 1 ? e.value = e.value + 1 : e.value = 0, o.value = A.imgList[e.value];
  }, n = () => {
    let r = document.querySelector(".img-dialog").querySelector(".img");
    i.value = i.value - 90, r.setAttribute("style", `transition:transform 0.5s;transform:rotate(${i.value}deg)`);
  }, E = () => {
    let r = document.querySelector(".img-dialog").querySelector(".img");
    i.value = i.value + 90, r.setAttribute("style", `transition:transform 0.5s;transform:rotate(${i.value}deg)`);
  }, a = () => {
    w.isEnabled && w.toggle();
  }, Q = () => {
    o.value = A.imgList[e.value], w.isEnabled && w.on("change", L);
  }, L = () => {
    s.value = w.isFullscreen;
  }, I = () => {
    let r = document.querySelector(".img-dialog").querySelector(".img"), y = Number((r.offsetWidth * 1.1).toFixed(0)), k = Number((r.offsetHeight * 1.1).toFixed(0));
    y < 1e3 && k < 1e3 && r.setAttribute("style", "height:" + k + "px;width:" + y + "px");
  }, l = () => {
    let r = document.querySelector(".img-dialog").querySelector(".img"), y = Number((r.offsetWidth * 0.9).toFixed(0)), k = Number((r.offsetHeight * 0.9).toFixed(0));
    y > 150 && k > 150 && r.setAttribute("style", "height:" + k + "px;width:" + y + "px");
  }, F = () => {
    let M = window, r = document;
    M.onmousewheel = r.onmousewheel = (y) => {
      y.wheelDelta < 0 ? I() : y.wheelDelta > 0 && l();
    };
  };
  return U(() => {
    F(), Q();
  }), {
    curImgIndex: e,
    curImg: o,
    handleClose: C,
    handlePrevious: c,
    handleNext: u,
    handleCounterRota: n,
    handleClockwiseRota: E,
    handleFullScreen: a,
    handleEnlargeImage: I,
    handleZoomOutImage: l,
    handleChangeImgSize: F
  };
}, j = (A) => (V("data-v-b8338873"), A = A(), q(), A), rA = { class: "img-dialog" }, EA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("div", { class: "img-dialog-mask" }, null, -1)), QA = { class: "img-dialog-curImg" }, hA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-chacha",
  style: { "font-size": "40px" }
}, null, -1)), MA = [
  hA
], dA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-icprevious",
  style: { "font-size": "58px" }
}, null, -1)), BA = [
  dA
], mA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-icnext",
  style: { "font-size": "58px" }
}, null, -1)), DA = [
  mA
], jA = { class: "operationConsole u-f u-f-ac u-f-aja" }, yA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-suoxiao",
  style: { "font-size": "28px" }
}, null, -1)), SA = [
  yA
], kA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-fangda",
  style: { "font-size": "28px" }
}, null, -1)), wA = [
  kA
], LA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-24gl-fullScreenEnter2",
  style: { "font-size": "28px" }
}, null, -1)), FA = [
  LA
], KA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-xiangzuoxuanzhuan",
  style: { "font-size": "28px" }
}, null, -1)), NA = [
  KA
], YA = /* @__PURE__ */ j(() => /* @__PURE__ */ g("i", {
  class: "icon image-lazy-iconfont icon-xiangyouxuanzhuan",
  style: { "font-size": "28px" }
}, null, -1)), UA = [
  YA
], OA = { class: "img-dialog-img u-f u-f-ac u-f-ajc" }, xA = ["src"], JA = /* @__PURE__ */ O({
  __name: "imgDialog",
  props: {
    imgList: {
      type: Array,
      default: []
    }
  },
  setup(A) {
    const o = A;
    let {
      curImgIndex: e,
      curImg: s,
      handleClose: i,
      handlePrevious: C,
      handleNext: c,
      handleCounterRota: u,
      handleClockwiseRota: n,
      handleFullScreen: E,
      handleEnlargeImage: a,
      handleZoomOutImage: Q
    } = aA(o);
    return (L, I) => (d(), B("div", rA, [
      EA,
      g("div", QA, J(t(e) + 1) + " / " + J(t(o).imgList.length ?? 0), 1),
      g("div", {
        onClick: I[0] || (I[0] = //@ts-ignore
        (...l) => t(i) && t(i)(...l)),
        class: "close u-f u-f-ac u-f-ajc",
        style: { width: "44px", height: "44px" }
      }, MA),
      g("div", {
        onClick: I[1] || (I[1] = //@ts-ignore
        (...l) => t(C) && t(C)(...l)),
        class: "previous u-f u-f-ac u-f-ajc",
        style: { width: "60px", height: "60px" }
      }, BA),
      g("div", {
        onClick: I[2] || (I[2] = //@ts-ignore
        (...l) => t(c) && t(c)(...l)),
        class: "next u-f u-f-ac u-f-ajc",
        style: { width: "60px", height: "60px" }
      }, DA),
      g("div", jA, [
        g("div", {
          onClick: I[3] || (I[3] = //@ts-ignore
          (...l) => t(Q) && t(Q)(...l))
        }, SA),
        g("div", {
          onClick: I[4] || (I[4] = //@ts-ignore
          (...l) => t(a) && t(a)(...l))
        }, wA),
        g("div", {
          onClick: I[5] || (I[5] = //@ts-ignore
          (...l) => t(E) && t(E)(...l)),
          style: { width: "40px" },
          class: "u-f u-f-ac u-f-ajc"
        }, FA),
        g("div", {
          onClick: I[6] || (I[6] = //@ts-ignore
          (...l) => t(u) && t(u)(...l))
        }, NA),
        g("div", {
          onClick: I[7] || (I[7] = //@ts-ignore
          (...l) => t(n) && t(n)(...l))
        }, UA)
      ]),
      g("div", OA, [
        g("img", {
          class: "img",
          src: t(s)
        }, null, 8, xA)
      ])
    ]));
  }
});
const fA = /* @__PURE__ */ x(JA, [["__scopeId", "data-v-b8338873"]]), pA = (A) => {
  let o = R(), e = !!Z().error, s = m();
  m(!1);
  let i = m({
    isLoading: !0,
    //是否记载
    loadingStatus: !0
    //加载状态 成功true或者失败false
  });
  const C = (n, E) => {
    n.src = E, n.onload = function(a) {
      i.value.loadingStatus = !0, i.value.isLoading = !1;
    }, n.onerror = function(a) {
      i.value.loadingStatus = !1, i.value.isLoading = !1;
    };
  }, c = () => {
    const { stop: n } = H(s.value, async ([{ isIntersecting: E }], a) => {
      E && (n(), await C(s.value, A.src));
    }, { threshold: 0 });
  }, u = () => {
    if (!A.isShowImgDialog)
      return;
    let n = document.createElement("div");
    n.setAttribute("style", "transition:opacity 0.1s;opacity:0;"), document.body.appendChild(n);
    const a = { imgList: A.imgList };
    _(X(fA, a), n), setTimeout(() => {
      document.documentElement.style.overflowY = "hidden", n.setAttribute("style", "transition:opacity 0.1s;opacity:1");
    }, 200);
  };
  return U(() => {
    c();
  }), {
    attrs: o,
    error: e,
    imgStatus: i,
    imgRef: s,
    handleCheckImg: u
  };
}, TA = {
  key: 0,
  class: "u-f u-f-ac u-f-ajc",
  style: { "z-index": "10", position: "absolute", width: "100%", height: "100%" }
}, RA = {
  key: 1,
  style: { "min-width": "50px", width: "100%" },
  class: "u-f u-f-ac u-f-ajc"
}, GA = ["src"], zA = /* @__PURE__ */ O({
  __name: "imageLazy",
  props: {
    imgList: {
      //有图片列表，暂时图片查看
      type: Array,
      default: []
    },
    src: {
      //图片路径
      type: String,
      default: ""
    },
    loadingColor: {
      //加载图标主题颜色
      type: String,
      default: "#2dbff1"
    },
    errorColor: {
      //加载图标主题颜色
      type: String,
      default: "#888888"
    },
    imgStyle: {
      //图片样式
      type: String,
      default: ""
    },
    isShowImgDialog: {
      //是否显示图片查看弹出框
      type: Boolean,
      default: !0
    },
    lazy: {
      //是否开启懒加载
      type: Boolean,
      default: !0
    },
    key: {
      //图片索引
      type: [String, Number],
      default: 0
    }
  },
  setup(A) {
    const o = A;
    let { attrs: e, error: s, imgStatus: i, imgRef: C, handleCheckImg: c } = pA(o);
    return (u, n) => (d(), B("div", G({ class: "image-lazy u-f u-f-ac u-f-ajc" }, t(e), {
      style: "cursor:pointer",
      onClick: n[0] || (n[0] = //@ts-ignore
      (...E) => t(c) && t(c)(...E))
    }), [
      t(i).isLoading ? (d(), B("div", TA, [
        $(t(cA), {
          primaryColor: o.loadingColor
        }, null, 8, ["primaryColor"])
      ])) : AA("", !0),
      t(i).loadingStatus ? (d(), B("div", RA, [
        o.lazy ? (d(), B("img", {
          class: "image-lazy-item",
          key: o.key,
          style: S(o.imgStyle),
          ref_key: "imgRef",
          ref: C
        }, null, 4)) : (d(), B("img", {
          class: "image-lazy-item",
          key: o.key,
          style: S(o.imgStyle),
          src: o.src
        }, null, 12, GA))
      ])) : (d(), B(eA, { key: 2 }, [
        t(s) ? oA(u.$slots, "error", { key: 0 }, void 0, !0) : (d(), B("i", {
          key: 1,
          style: S("font-size:58px;color:" + o.errorColor),
          class: "icon image-lazy-iconfont icon-tupianjiazaishibai"
        }, null, 4))
      ], 64))
    ], 16));
  }
});
const HA = /* @__PURE__ */ x(zA, [["__scopeId", "data-v-d55b2021"]]), vA = (A, o) => {
  let e = {
    loadingGif: (o == null ? void 0 : o.loadingGif) ?? CA,
    //加载gif动图
    errorImg: (o == null ? void 0 : o.errorImg) ?? IA
    //错误图片自定义
  };
  const s = (i, C) => new Promise(function(c, u) {
    i.src = C, i.onload = function(n) {
      c(!0);
    }, i.onerror = function(n) {
      i.src = e.errorImg, u(!1);
    };
  });
  A.directive("img-lazy", {
    //数据挂载和渲染完成
    mounted(i, C) {
      let { value: c } = C, u = i;
      u.src = e.loadingGif;
      const { stop: n } = H(u, async ([{ isIntersecting: E }], a) => {
        E && (n(), await s(u, c).catch((Q) => Q));
      }, { threshold: 0 });
    },
    deep: !0
  });
};
let bA = [vA], PA = [HA];
const WA = (A, o) => {
  PA.map((e) => {
    A.component(e.__name, e);
  }), bA.map((e) => {
    e(A, o);
  });
};
let Y = window;
if (typeof Y < "u" && Y.Vue) {
  const A = Y.Vue.createApp({});
  WA(A);
}
export {
  WA as default
};
